home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 19 / Amiga Plus Leser CD 19.iso / Tools / Freeware / Swf_Player / Lib / script.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-17  |  4.8 KB  |  145 lines

  1. #ifndef _SCRIPT_H_
  2. #define _SCRIPT_H_
  3.  
  4. // SWF file parser.
  5. //
  6. //////////////////////////////////////////////////////////////////////
  7.  
  8. //////////////////////////////////////////////////////////////////////
  9. // Input script object definition.
  10. //////////////////////////////////////////////////////////////////////
  11.  
  12. // An input script object.  This object represents a script created from 
  13. // an external file that is meant to be inserted into an output script.
  14. struct CInputScript  : public Dict
  15. {
  16.     int level;
  17.     struct CInputScript *next;
  18.  
  19.     Program *program;    // Current parsed program
  20.  
  21.         // Memory fences
  22.     int  outOfMemory;
  23.  
  24.     //Flash info
  25.     long frameRate;
  26.     long frameCount;
  27.     Rect frameRect;
  28.  
  29.     // Pointer to file contents buffer.
  30.     U8 *m_fileBuf;
  31.  
  32.     // File state information.
  33.     U32 m_filePos;
  34.     U32 m_fileSize;
  35.     U32 m_actualSize;
  36.     U32 m_fileStart;
  37.     U16 m_fileVersion;
  38.  
  39.     int needHeader;
  40.  
  41.     // Bit Handling
  42.     S32 m_bitPos;
  43.     U32 m_bitBuf;
  44.  
  45.     // Tag parsing information.
  46.     U32 m_tagStart;
  47.     U32 m_tagEnd;
  48.     U32 m_tagLen;
  49.  
  50.     // Parsing information.
  51.     S32 m_nFillBits;
  52.     S32 m_nLineBits;
  53.     S32 m_nGlyphBits;
  54.     S32 m_nAdvanceBits;
  55.  
  56.     // Set to true if we wish to dump all contents long form
  57.     U32 m_dumpAll;
  58.  
  59.     // if set to true will dump image guts (i.e. jpeg, zlib, etc. data)
  60.     U32 m_dumpGuts;
  61.  
  62.     // Handle to output file.
  63.     FILE *m_outputFile;
  64.  
  65.     // Constructor/destructor.
  66.     CInputScript(int level = 0);
  67.     ~CInputScript();
  68.  
  69.     // Tag scanning methods.
  70.     U16 GetTag(void);
  71.     U8 GetByte(void);
  72.     U16 GetWord(void);
  73.     U32 GetDWord(void);
  74.     void GetRect(Rect *r);
  75.     void GetMatrix(Matrix *matrix);
  76.  
  77.     void GetCxform(Cxform *cxform, BOOL hasAlpha);
  78.     char *GetString(void);
  79.  
  80.     // Routines for reading arbitrary sized bit fields from the stream.
  81.     // Always call start bits before gettings bits and do not intermix 
  82.     // these calls with GetByte, etc...    
  83.     void InitBits();
  84.     S32 GetSBits(S32 n);
  85.     U32 GetBits(S32 n);
  86.  
  87.     // Tag subcomponent parsing methods
  88.     void ParseFillStyle(long getAlpha = 0);
  89.     void ParseLineStyle(long getAlpha = 0);
  90.     int  ParseShapeRecord(long getAlpha = 0);
  91.     ButtonRecord *  ParseButtonRecord(long getCxform = 0);
  92.     ActionRecord *  ParseActionRecord();
  93.     TextRecord   *  ParseTextRecord(int hasAlpha = 0);
  94.         void ParseShapeData(int getAlpha, int getStyles);
  95.  
  96.     // Parsing methods.
  97.     void ParseEnd();                // 00: stagEnd
  98.     void ParseShowFrame(U32 frame, U32 offset);    // 01: stagShowFrame
  99.     void ParseDefineShape(int level);        // 02: stagDefineShape
  100.     void ParseFreeCharacter();                         // 03: stagFreeCharacter
  101.     void ParsePlaceObject();            // 04: stagPlaceObject
  102.     void ParseRemoveObject();                          // 05: stagRemoveObject
  103.     void ParseDefineBits();                            // 06: stagDefineBits
  104.     void ParseDefineButton();               //x 07: stagDefineButton
  105.     void ParseJPEGTables();                        // 08: stagJPEGTables
  106.     void ParseSetBackgroundColor();                    // 09: stagSetBackgroundColor
  107.     void ParseDefineFont();                 //x 10: stagDefineFont
  108.     void ParseDefineText(int hasAplha);            //x 11: stagDefineText    33: stagDefineText2
  109.     void ParseDoAction();                              // 12: stagDoAction    
  110.     void ParseDefineFontInfo();             //x 13: stagDefineFontInfo
  111.     void ParseDefineSound();                           // 14: stagDefineSound
  112.     void ParseStartSound();                            // 15: stagStartSound
  113.     void ParseStopSound();                             // 16: stagStopSound
  114.     void ParseDefineButtonSound();                     // 17: stagDefineButtonSound
  115.     void ParseSoundStreamHead();                        // 18: stagSoundStreamHead
  116.     void ParseSoundStreamBlock();                      // 19: stagSoundStreamBlock
  117.     void ParseDefineBitsLossless(int level);           // 20: stagDefineBitsLossless 36: stagDefineBitsLossless2
  118.     void ParseDefineBitsJPEG2();                       // 21: stagDefineBitsJPEG2
  119.     void ParseDefineButtonCxform();                    // 23: stagDefineButtonCxform
  120.     void ParseProtect();                               // 24: stagProtect
  121.     void ParsePlaceObject2();                          // 26: stagPlaceObject2
  122.     void ParseRemoveObject2();                         // 28: stagRemoveObject2
  123.     void ParseDefineButton2();              //x 34: stagDefineButton2
  124.     void ParseDefineBitsJPEG3();                       // 35: stagDefineBitsJPEG3
  125.     void ParseDefineMouseTarget();                     // 38: stagDefineMouseTarget
  126.     void ParseDefineSprite();               //x 39: stagDefineSprite
  127.     void ParseNameCharacter();                         // 40: stagNameCharacter
  128.     void ParseFrameLabel();                            // 43: stagFrameLabel
  129.     void ParseSoundStreamHead2();                        // 45: stagSoundStreamHead2
  130.     void ParseDefineMorphShape();           //x 46: stagDefineMorphShape
  131.     void ParseDefineFont2();                //x 48: stagDefineFont2
  132.     void ParseUnknown(long,long);
  133.  
  134.     void ParseTags(int *);
  135.     int  ParseData(FlashMovie *movie, char * data, long size);
  136.     void S_DumpImageGuts();
  137.  
  138. #ifdef DUMP
  139.     long save(char *filenam);
  140. #endif
  141. };
  142.  
  143.  
  144. #endif /* _SCRIPT_H_ */
  145.